
function jquery(a){return document.getElementById(a)};
var QJ={};
QJ.addScro=function(a){
jquery(a).style.overflow="hidden";
var _width=jquery(a).clientWidth;
var _height=jquery(a).clientHeight;
var html="<div id=\""+a+"_left\" class=\"QJscroll_left\" style=\"width:"+(_width-56)+"px\">"+jquery(a).innerHTML+"</div>";
html+="<div id=\""+a+"_right\" class=\"QJscroll_right\">";
html+="<div id=\""+a+"_cen\" class=\"QJscroll_cen\" style=\"height:"+(_height)+"px\">";
html+="<div id=\""+a+"_box\" class=\"QJscroll_box\" style=\"top:0px\" onmousedown=\"QJ.addScroChe(event,'"+a+"',2)\" onmouseout=\"this.style.backgroundPosition='0 0'\" onmouseup=\"\"></div>"
html+="</div>";
jquery(a).innerHTML=html;
QJ.addScroChe("",a,1);
};
var QJScrolling="",QJScrollNum,QJScrollTimer;
document.onmousemove=function(e){if(QJScrolling!="")QJ.addScroChe(e,QJScrolling,3)};
document.onmouseup=function(e){QJScrolling="";clearTimeout(QJScrollTimer)};
try{window.addEventListener("DOMMouseScroll",function(e){QJ.addScroChe(e,"",4)},false);}catch(err){document.onmousewheel=function(e){QJ.addScroChe(e,"",4)}};
QJ.addScroChe=function(a,b,c){
switch(c){
case 1:
jquery(b+"_left").scrollTop=0;
var H=jquery(b+"_left").clientHeight/jquery(b+"_left").scrollHeight;
jquery(b+"_left").scrollTop=0;
if(H>=1){jquery(b+"_box").style.display="none"}else{jquery(b+"_box").style.display="";jquery(b+"_box").style.height="45px";jquery(b+"_box").style.top="0px"};
break;
case 2:
QJScrolling=b;
var event=a||window.event;
QJScrollNum=event.clientY-parseInt(jquery(QJScrolling+"_box").style.top);
break;
case 3:
var event=a||window.event;
QJ.addScroChe(event.clientY-QJScrollNum,b,0)
break;
case 4:
var event=a||window.event;
var ele=event.target||event.srcElement;
if(ele.className!="QJscroll_left")return;
b=ele.id.split("_left")[0];
var H=jquery(b+"_left").scrollTop;
if(event.wheelDelta<=0||event.detail>0){H=H+80}else{H=H-80};
try{event.preventDefault()}catch(err){event.returnValue=false};
var H2=jquery(b+"_left").scrollHeight-jquery(b+"_left").clientHeight;
if(H<0)H=0;if(H>H2)H=H2;
var H3=H/H2*(jquery(b+"_cen").clientHeight-jquery(b+"_box").clientHeight);
jquery(b+"_left").scrollTop=H;
jquery(b+"_box").style.top=H3+"px";
break;
case 5:
clearTimeout(QJScrollTimer);
QJ.addScroChe(parseInt(jquery(b+"_box").style.top)+a,b,0)
QJScrollTimer=window.setTimeout("QJ.addScroChe("+a+",'"+b+"',5)",20);
break;
case 0:
var H=jquery(b+"_cen").clientHeight-jquery(b+"_box").clientHeight;
if(a<0)a=0;if(a>H)a=H;
var H2=a/H*(jquery(b+"_left").scrollHeight-jquery(b+"_left").clientHeight);
jquery(b+"_box").style.top=a+"px";
jquery(b+"_left").scrollTop=H2;
break;
};
};
QJ.seroInner=function(a,b){
jquery(a+"_left").innerHTML=b;
QJ.addScroChe("",a,1);
};

QJ.addScro('demo1');